<template>
  <div>

    <div style="height: 40px;">
      <div style="float: right;">
        <a-input-search style="width: 200px;" :placeholder="$t('m.common.label.guan-jian-zi')" enter-button @search="onSearch"></a-input-search>
      </div>
    </div>

    <a-table
      ref="table"
      size="middle"
      bordered
      :rowKey="rowKey"
      :columns="columns"
      :dataSource="dataSource"
      :pagination="ipagination"
      :loading="loading"
      :rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange, type: (radio ? 'radio' : 'checkbox')}"
      @change="handleTableChange"
      :customRow="clickThenCheck"
    >
      <template slot="serialNum" slot-scope="text,record,index">
        {{ (ipagination.current - 1) * ipagination.pageSize + parseInt(index) + 1 }}
      </template>
    </a-table>
  </div>
</template>

<script>

import {YcListMixin} from '@/mixins/YcListMixin'
import {filterMultiDictText} from '@/components/dict/YchDictSelectUtil'
import {EFormConstant} from '../../EFormConstant'
import YchConstant from "@/api/YchConstant";

export default {
  name: 'ActAppViewLayoutList',
  mixins: [YcListMixin],
  props: {
    radio: Boolean,
    groupId: {
      type: String,
      required: true
    },
  },
  data() {
    return {
      queryParam: {
        viewStatus: '1',
        groupId: this.groupId
      },
      isorter: {
        column: 'orderNum',
        order: 'asc',
      },
      columns: [
        {
          title:this.$t('m.common.label.number'),
          dataIndex: '',
          key: 'rowIndex',
          width: 50,
          align: 'center',
          scopedSlots: {customRender: 'serialNum'},
        },
        {
          title: this.$t('m.eform.appview.entity.viewName'),
          align: 'center',
          dataIndex: 'viewName'
        },
        {
          title: this.$t('m.eform.appview.entity.viewCode'),
          align: 'center',
          dataIndex: 'viewCode'
        },
        {
          title: this.$t('m.eform.appview.entity.viewType'),
          align: 'center',
          dataIndex: 'viewType',
          customRender: (text) => {
            if (!text) {
              return ''
            } else {
              return filterMultiDictText(EFormConstant.viewTypeAll, text + '')
            }
          }
        },
      ],
      url: {
        list: YchConstant.PREFIX_EFORM + '/manage/actAppView/listLayoutView',
      }
    }
  },
  methods: {}
}
</script>
